package com.jh.user.pojo;

import cn.jh.common.exception.ServiceException;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 台卡表
 */
@Entity
@Table(name="t_platform")
public class Platform implements Serializable  {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name="platform_id")
    private String platformId;
    /**
     * 台卡卡号
     */

    @Column(name="platform_code")
    private String platformCode;

    /**
     * 商铺名称
     */
    @Transient
    private String shopName;

    /**
     * 台卡类型
     */
    @Column(name="platform_type")
    private String platformType;

    /**
     * 所属代理商
     */
    @Column(name="agent")
    private String agent;

    /**
     * 商户ID
     */
    @Column(name="shop_id")
    private String shopId;

    /**
     * 拨码状态,0：未拨码，1：已拨码
     */
    @Column(name="dial_code_type")
    private String dialCodeType;

    /**
     * 台卡状态 0：未绑定，1：已绑定 2已激活
     */
    @Column(name="state")
    private String state;

    /**
     * 二维码地址
     */
    @Column(name="qrc_code")
    private String qrcCode;

    /**
     * 创建时间
     */
    @Column(name="create_time")
    private String createTime;

    /**
     * 创建人
     */
    @Column(name="create_by")
    private String createBy;

    /**
     * 创建人
     */
    @Column(name="update_time")
    private String updateTime;

    /**
     * 更新人
     */
    @Column(name="update_by")
    private String updateBy;

    /**
     * 推荐人手机号
     */
    @Column(name="introducer_phone")
    private String introducerPhone;

    /**
     * 是否上传快银进件图片：0已提交，1未提交
     */
    @Transient
    private long isUploadFsPic;

    public String getPlatformCode() {
        return platformCode;
    }

    public void setPlatformCode(String platformCode) {
        this.platformCode = platformCode;
    }

    public String getPlatformType() {
        return platformType;
    }

    public void setPlatformType(String platformType) {
        this.platformType = platformType;
    }

    public String getAgent() {
        return agent;
    }

    public void setAgent(String agent) {
        this.agent = agent;
    }

    public String getShopId() {
        return shopId;
    }

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public String getDialCodeType() {
        return dialCodeType;
    }

    public void setDialCodeType(String dialCodeType) {
        this.dialCodeType = dialCodeType;
    }

    public String getQrcCode() {
        return qrcCode;
    }

    public void setQrcCode(String qrcCode) {
        this.qrcCode = qrcCode;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public String getPlatformId() {
        return platformId;
    }

    public void setPlatformId(String platformId) {
        this.platformId = platformId;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public void activeValidation() {
        if (Objects.equals(getState(), "0")) {
            throw new ServiceException("台码未绑定");
        }
        if (Objects.equals(getState(), "1")) {
            throw new ServiceException("台码未激活");
        }
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getIntroducerPhone() {
        return introducerPhone;
    }

    public void setIntroducerPhone(String introducerPhone) {
        this.introducerPhone = introducerPhone;
    }

    public long getIsUploadFsPic() {
        return isUploadFsPic;
    }

    public void setIsUploadFsPic(long isUploadFsPic) {
        this.isUploadFsPic = isUploadFsPic;
    }

    @Override
    public String toString() {
        return "Platform{" +
                "platformId='" + platformId + '\'' +
                ", platformCode='" + platformCode + '\'' +
                ", shopName='" + shopName + '\'' +
                ", platformType='" + platformType + '\'' +
                ", agent='" + agent + '\'' +
                ", shopId='" + shopId + '\'' +
                ", dialCodeType='" + dialCodeType + '\'' +
                ", state='" + state + '\'' +
                ", qrcCode='" + qrcCode + '\'' +
                ", createTime='" + createTime + '\'' +
                ", createBy='" + createBy + '\'' +
                ", updateTime='" + updateTime + '\'' +
                ", updateBy='" + updateBy + '\'' +
                ", introducerPhone='" + introducerPhone + '\'' +
                ", isUploadFsPic='" + isUploadFsPic + '\'' +
                '}';
    }
}
